﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PublicationList.aspx.cs" Inherits="Medianamik.UI.ContentManagement.PublicationList"
 MasterPageFile="../MasterPages/MedianamikModule.Master" %>
<%@ Import Namespace="Medianamik.Core" %>
<%@ Import Namespace="Medianamik.Core.Sugar"%>

<asp:Content ID="ContextMenuContent" ContentPlaceHolderID="ContextMenu" runat="server">
    <asp:LinkButton runat="server" ID="btnPublish" CssClass="Action BtPublier" Text="<%$ Resources: Medianamik_ContentManagement, PublishActionButton %>" OnClick="btnPublish_Click" ></asp:LinkButton>
    <asp:LinkButton runat="server" ID="btnReject" CssClass="Action BtDesapprouver" Text="<%$ Resources: Medianamik_ContentManagement, RejectActionButton %>" OnClick="btnReject_Click" ></asp:LinkButton>
    <a href="#" class="Action BtAnnuler-Inactif"><asp:Literal runat="server" Text="<%$ Resources: Medianamik_Global, Cancel %>" /></a>
</asp:Content>

<asp:Content ContentPlaceHolderID="HeaderContentHolder" runat="server">
    <script type ="text/javascript" >
        toggleCheckboxes = function() {
            $(".ChkPublish > input").each(function(i) {
                this.checked = !this.checked;
            });
        }
    </script>
</asp:Content>

<asp:Content ID="MainTreeView" ContentPlaceHolderID="VariableRightPanel" runat="server">
   	
</asp:Content>
 
<asp:Content ID="CenterContent" ContentPlaceHolderID="CenterContent" runat="server">
    <asp:UpdatePanel runat="server" id="upl">
        <ContentTemplate>
            <lock:LockInfoTooltip runat="server" id="LockInfoTooltip" OnLockDeleted="LockInfoTooltip_LockDeleted"></lock:LockInfoTooltip>
            <telerik:RadGrid runat="server" ID="GridNodes" EnableEmbeddedSkins="false" Skin="Medianamik" AllowPaging="false" AutoGenerateColumns="false"
        OnItemCommand="GridNodes_ItemCommand"  OnNeedDataSource="GridNodes_NeedDataSource" OnItemDataBound="GridNodes_ItemDataBound"
       AllowMultiRowSelection="false" Width="100%">
        <MasterTableView DataKeyNames="ID" GroupLoadMode="Client">
            <GroupByExpressions>
            <telerik:GridGroupByExpression>
            <SelectFields>
                    <telerik:GridGroupByField FieldAlias="<%$ Resources: Medianamik_ContentManagement, Container %>" FieldName="ParentName" ></telerik:GridGroupByField>
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldAlias = "<%$ Resources: Medianamik_ContentManagement, Container %>" FieldName="ParentName"  >
                        
                    </telerik:GridGroupByField>
                </GroupByFields>
            </telerik:GridGroupByExpression>
            </GroupByExpressions>
            <Columns>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate><asp:Literal runat="server" Text="<%$ Resources: Medianamik_ContentManagement, ModifiedContentColumn %>"></asp:Literal></HeaderTemplate>
                    <ItemTemplate><med:NodeTypeIcon ID="NodeTypeIcon1" runat="server" NodeTypeId='<%# Eval("Node.NodeType.ID") %>'></med:NodeTypeIcon><a href="NodeList.aspx?<%# DefaultParamNames.ParentNodeID %>=<%# Eval("Node.ParentID") %>" ><%# Eval("Node.DisplayName") %></a></ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate><asp:Literal runat="server" Text="<%$ Resources: Medianamik_ContentManagement, LastModificationColumn %>"></asp:Literal></HeaderTemplate>
                    <ItemTemplate><%# Eval("EditedOn") %></ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate><asp:Literal runat="server" Text="<%$ Resources: Medianamik_ContentManagement, ModifiedByColumn %>"></asp:Literal></HeaderTemplate>
                    <ItemTemplate><%# Eval("EditedBy") %></ItemTemplate>
                </telerik:GridTemplateColumn>
                
                
                <telerik:GridTemplateColumn HeaderStyle-Width="1%" HeaderText="Actions">
					<HeaderStyle HorizontalAlign="Center" />
					<ItemStyle CssClass="Actions" />
					<ItemTemplate>
						<table border="0" cellpadding="0" cellspacing="0" align="center">
							<tr>
							    <td><med:DiffLink Enabled="true" runat="server" Title='<%$ Resources: Medianamik_Global, Action_PreviewTooltip %>' NodeId='<%# Eval("ID") %>' >diff</med:DiffLink></td>
								<td><med:LockButton ID="EditLink1" runat="server" Title='<%$ Resources: Medianamik_Global, Action_EditTooltip %>' NavigateUrl='<%# "Nodemanagement.aspx?" + DefaultParamNames.NodeID + "=" + Eval("ID") + "&amp;returnUrl=" + Request.Url.PathAndQuery.UrlEncodeBase64() %>' NodeId='<%# Eval("ID") %>' OnRequestFailed= "LockLink_RequestFailed" ImageUrl="/Medianamik/images/Icones/Ico_Edition.gif" LockedOrDisabledImageUrl="/Medianamik/images/Icones/Ico_EditionInactif.gif" /></td>
						    </tr>
						</table>
					</ItemTemplate>
				</telerik:GridTemplateColumn>
				<telerik:GridTemplateColumn HeaderStyle-Width="1%" HeaderText="">
					<HeaderStyle HorizontalAlign="Center" />
					<ItemStyle CssClass="Actions" />
					<HeaderTemplate>
					    <input type="checkbox" id="chkAll"  onclick ="toggleCheckboxes();"  /> 
					</HeaderTemplate>
					<ItemTemplate>
						<table border="0" cellpadding="0" cellspacing="0" align="center">
							<tr>
							    <td><asp:CheckBox runat="server" CssClass="ChkPublish"  ID="chkPublish" value='<%# Eval("ID") %>'  /> </td>
						    </tr>
						</table>
					</ItemTemplate>
				</telerik:GridTemplateColumn>
            </Columns>
            <NoRecordsTemplate>
			    <asp:Literal ID="NoRecords" runat="server" Text="<%$ Resources: Medianamik_ContentManagement, NoRecordsToDisplay %>" />
			</NoRecordsTemplate>
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True"  />
            <ClientEvents  />
        </ClientSettings>
        <PagerStyle ShowPagerText="false" Mode="NumericPages" Position="TopAndBottom" />
    </telerik:RadGrid>
        </ContentTemplate>
    </asp:UpdatePanel>
    
</asp:Content>
<asp:Content ID="ExternalContent" ContentPlaceHolderID="ExternalContentHolder" runat="server">
   <script language="javascript" type="text/javascript">
        //<![CDATA[                                                                 
        function CallBackFunction(radWindow, returnValue)
        {
            if (returnValue) {
                var argument = returnValue.get_argument();
                if (argument && argument.NodeTypeId) {
                    if (argument.ParentNodeId) {
                        location.href = "/medianamik/contentmanagement/nodemanagement.aspx?typeid=" + argument.NodeTypeId + "&parentnodeid=" + argument.ParentNodeId;
                    }
                    else {
                        location.href = "/medianamik/contentmanagement/nodemanagement.aspx?typeid=" + argument.NodeTypeId;
                    }
                }
            }
        }
        //]]>
   </script>
    <telerik:RadWindowManager ID="Singleton" runat="server" EnableEmbeddedSkins="false" Skin="Medianamik" Behaviors="Close">
        <Windows>
            <telerik:RadWindow ID="DialogWindow" EnableEmbeddedSkins="false" Skin="Medianamik" ReloadOnShow="true" Behaviors="Close" VisibleStatusbar="false"
                OnClientClose="CallBackFunction" DestroyOnClose="false" EnableTheming="false"
                Modal="true" runat="server" Width="270px" Height="150px" Title="Type de noeud" IconUrl="/Medianamik/images/Icones/Ico_AjoutPage.gif" />
        </Windows>
    </telerik:RadWindowManager>
</asp:Content>
